package com.wxzhou.wangzhuan.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 补贴实体
 */
public class WzButie implements Serializable {
    private Long id;

    // 针对谁补贴（发生用户）
    private Long userId;

    // 补贴场景，对应sense
    private Integer sense;

    //补贴方式，1：用户收益=N-M随机值，2：用户收益=广告实际价值+补贴
    private Integer butie_type;

    // 每日补贴金额上限(单位:分)
    private BigDecimal day_max_amount;
    //补贴金额范围左值(单位:分)
    private BigDecimal day_amount_left;
    //补贴金额范围右值(单位:分)
    private BigDecimal day_amount_right;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime start_at;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime end_at;

    // 创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createdAt;

    //是否已过期
    private Boolean hasExpired;

    //是否还未开始
    private Boolean hasNotStart;

    // 备注
    private String remark;


    public WzButie() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Integer getSense() {
        return sense;
    }

    public void setSense(Integer bsac) {
        this.sense = bsac;
    }

    public Integer getButie_type() {
        return butie_type;
    }

    public void setButie_type(Integer butie_type) {
        this.butie_type = butie_type;
    }

    public BigDecimal getDay_max_amount() {
        return day_max_amount;
    }

    public void setDay_max_amount(BigDecimal day_max_amount) {
        this.day_max_amount = day_max_amount;
    }

    public BigDecimal getDay_amount_left() {
        return day_amount_left;
    }

    public void setDay_amount_left(BigDecimal day_amount_left) {
        this.day_amount_left = day_amount_left;
    }

    public BigDecimal getDay_amount_right() {
        return day_amount_right;
    }

    public void setDay_amount_right(BigDecimal day_amount_right) {
        this.day_amount_right = day_amount_right;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public LocalDateTime getStart_at() {
        return start_at;
    }

    public void setStart_at(LocalDateTime start_at) {
        this.start_at = start_at;
    }

    public LocalDateTime getEnd_at() {
        return end_at;
    }

    public void setEnd_at(LocalDateTime end_at) {
        this.end_at = end_at;
    }

    //过期返回true，即：超过了结束时间
    public Boolean getHasExpired() {
        return LocalDateTime.now().compareTo(getEnd_at()) > 0;
    }

    public void setHasExpired(Boolean hasExpired) {
        this.hasExpired = hasExpired;
    }

    //策略开始时间大于当前时间，则是未开始
    public Boolean getHasNotStart() {
        return getStart_at().compareTo(LocalDateTime.now()) > 0;
    }

    public void setHasNotStart(Boolean hasNotStart) {
        this.hasNotStart = hasNotStart;
    }


}
